package com.huibao.hulibao.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

/**
 * Created by lizhaoyong on 2018/5/9.
 */
public class HuLiViewPgaerAdapter extends PagerAdapter {

    private ArrayList<View> al_views;

    public HuLiViewPgaerAdapter(ArrayList<View> al_views) {
        this.al_views = al_views;
    }

    @Override
    public int getCount() {
        return al_views.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(al_views.get(position));
        return al_views.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(al_views.get(position));
    }
}
